/**
 * Created by LeeXyan
 */


(function () {
    Qbt = {};

    Qbt.contentIframe = $("#content-iframe");

    function fixContentIframe() {
        var neg = $('.main-header').outerHeight() + $('.main-footer').outerHeight();
        var window_height = $(window).height();
        var content_header_height = $(".content-header").height();

        Qbt.contentIframe.css("min-height", window_height - neg - content_header_height - 20);
    };

    fixContentIframe();

    var request = GetRequest();

    $(window).resize(fixContentIframe);
    Qbt.App = new Vue({
        el: "#app",
        data: {
            user: {
                username: request.username,
                avatar: 'vendor/admin-lte/img/user2-160x160.jpg'
            },
            pageHeader: '房屋租赁',
            historyBack: false

        }
    });


    function loadPage(url) {
        Qbt.contentIframe.attr('src', url);
    }

    /**
     *路由列表
     *
     */
    var routers;
    routers = {
        '/item': function () {loadPage('view/item.html');},
        '/newLease': function () {loadPage('view/common/newLease.html');},
        '/eRoom': function () {loadPage('view/common/room.html');},
        '/billing': function () {loadPage('view/common/billing.html');},
        '/networkSettings': function () {loadPage('view/common/networkSettings.html');},
        '/emptyRoom': function () {loadPage('view/info/emptyRoom.html');},
        '/historicalLease': function () {loadPage('view/info/historicalLease.html');},
        '/list': function () {loadPage('list.html');},
        '/register': function () {loadPage('view/privilege/register.html');},
        '/user': function () {loadPage('view/privilege/user.html');},
        '/room': function () {loadPage('view/colligate/room.html');},
        '/setting': function () {loadPage('view/sys/setting.html');
        }

    };

    var router = Router(routers).configure({
        notfound: function () {
            loadPage('404.html');
        }
    }).init("/item");
})();

